package leetcode.ge100;

import leetcode.lt100.TreeNode;


class Solution_111 {


    public static void main(String[] args) {
    }


    public int minDepth(TreeNode root) {
        if (root == null)
            return 0;
        int left = minDepth(root.left);
        int right = minDepth(root.right);
        if (left + right == 0) {
            return 1;
        }
        if (left * right == 0) {
            return left + right + 1;
        }
        return Math.min(left, right) + 1;
    }


}